home *** CD-ROM | disk | FTP | other *** search
/ Complete Internet Archive / Complete Internet Archive.iso / Modem Dialers & Utilities / LOGIN.CM_ / LOGIN
Text File  |  1996-12-11  |  4KB  |  197 lines

  1. #
  2. #  Trumpet Winsock 3.0 Login.cmd
  3. #
  4. #  Copyright (C) 1996 distributed by
  5. #  Trumpet Software International Pty Ltd 
  6. #  A.C.N 070065860
  7. #  Under Licence from the Copyright owners.
  8. #  All Rights Reserved.
  9. #  
  10. #
  11. #trace on
  12. #
  13. # set up some strings for dialling up
  14. #
  15. include "profile.cmd","preload"
  16. include "modem.cmd","preload"
  17. include "server.cmd","preload"
  18. %attempts = 10
  19.  
  20. ###############################################
  21. # timeouts for various sections of the script #
  22. ###############################################
  23. #
  24. #
  25. # timeout for busy tone... adjust this until the BUSY string is detected.
  26. %busytimeout = 10
  27. # time between successive busy attempts.
  28. %busywait = 1
  29. # time to wait for a CONNECT string to be received
  30. %connecttimeout = 60
  31. # time to wait until DCD is detected
  32. %onlinetimeout = 60
  33. # time to wait for username & password prompts
  34. %logintimeout = 60
  35. # time to wait for server prompt to appear
  36. %prompttimeout = 30
  37. # time to wait for a SLIP address to be parsed
  38. %addresstimeout = 30
  39. #
  40. #----------------------------------------------------------
  41. #
  42. # initialize modem
  43. #
  44. output \13
  45. %n = [input 1 \n]
  46. if %usereset
  47.   status "Initializing modem..."
  48.   output "at"$modemreset\13
  49.   %x = matchinput(10,"OK","ERROR")
  50.   if %x = 2
  51.     message "Incorrect modem reset string.    Please change profile."
  52.     abort
  53.   end
  54.   if %x = 0
  55.     message "Modem is not responding."
  56.     abort
  57.   end
  58. end
  59. #
  60. # setup our modem commands
  61. #
  62. output "at"$modeminit\13
  63. %x = matchinput(10,"OK","ERROR")
  64. if %x = 2
  65.   message "Incorrect modem init string.    Please change profile."
  66.   abort
  67. end
  68. if %x = 0
  69.   message "Modem is not responding."
  70.   abort
  71. end
  72. #
  73. # do the dial up....send phone number
  74. #
  75. %n = 0
  76. repeat
  77.   %n = %n + 1
  78.   if %n > %attempts
  79.     message "Too many dial attempts"
  80.     abort
  81.   end
  82.   status Dialling $number...(attempt %n)
  83.   output "at"$modemdial$number\13
  84.   %ok = 0
  85.   %which = matchinput(%connecttimeout,"CONNECT","BUSY","NO DIALTONE","NO CARRIER")
  86.   if %which = 1
  87.     %ok = 1
  88.   end
  89.   if %which = 2
  90.     status "The line is busy...pausing for a while"
  91.     sleep %busywait
  92.   end
  93.   if %which = 3
  94.     message "No Dial tone.  Please check modem or phone line."
  95.     abort
  96.   end
  97.   if %which = 4
  98.     message "No carrier - check condition of line or phone number"
  99.     abort
  100.   end
  101. until %ok
  102. input 10 \n
  103. #
  104. #  wait till it's safe to send because some modems hang up
  105. #  if you transmit during the connection phase
  106. #
  107. wait %onlinetimeout dcd
  108. status Connected.  Now logging in as $username...
  109. #
  110. # now prod the terminal server
  111. #
  112. #output \13
  113. #
  114. #  wait for the username prompt
  115. #
  116. if $promptuser <> ""
  117.   input %logintimeout $promptuser
  118.   output $username\13
  119. end
  120. #
  121. # and the password
  122. #
  123. if $promptpass <> ""
  124.   input %logintimeout $promptpass
  125.   output $password\13
  126. end
  127. #
  128. # we are now logged in
  129. #
  130. status "Logged in. Now switching to Internet..."
  131. if $promptcmd <> ""
  132.   input %prompttimeout $promptcmd
  133. end
  134. if %ppp
  135.   #
  136.   # jump into ppp mode
  137.   #
  138.   if $pppcmd <> ""
  139.     output $pppcmd\13
  140.   end
  141.   #
  142.   # wait for PPP prompt.
  143.   if $pppready <> ""
  144.     input %prompttimeout $pppready
  145.   end
  146.   #
  147.   if %getaddr
  148.     input %addresstimeout $addrprompt
  149.     #
  150.     # parse address
  151.     #
  152.     address %addresstimeout
  153.     input %addresstimeout \n
  154.     display \n
  155.     display PPP mode selected.  Your IP address is \i.\n
  156.     status Connected.  Your IP address is \i.
  157.   else
  158.     display \n\n"PPP mode selected.  Will try to negotiate IP address."\n
  159.     status "PPP mode selected.  Will try to negotiate IP address."
  160.     sleep 1
  161.   end
  162.   #
  163. else
  164.   #
  165.   # jump into slip mode
  166.   #
  167.   if $slipcmd <> ""
  168.     output $slipcmd\13
  169.   end
  170.   if $slipready <> ""
  171.     input %prompttimeout $slipready
  172.   end
  173.   #
  174.   # wait for the address string
  175.   #
  176.   if %getaddr
  177.     if $addrprompt <> ""
  178.       input %addresstimeout $addrprompt
  179.     end
  180.     #
  181.     # parse address
  182.     #
  183.     address 30
  184.     input %addresstimeout \n
  185.     display \n
  186.     display SLIP mode selected.  Your IP address is \i.\n
  187.     status SLIP mode selected.  Your IP address is \i.
  188.   else
  189.     display \n\n"SLIP mode selected.  Will try to negotiate IP address."\n
  190.     status "SLIP mode selected.  Will try to negotiate IP address."
  191.     sleep 1
  192.   end
  193. end
  194. #
  195. # now we are finished.
  196. #
  197.